home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / Slots.p < prev    next >
Text File  |  1995-09-12  |  14KB  |  401 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 10:01:52 PM }
  2. {
  3.      File:        Slots.p
  4.  
  5.      Contains:    Slot Manager Interfaces.
  6.  
  7.      Version:    Technology:    System 7.5
  8.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.  
  19. }
  20.  
  21.  UNIT Slots;
  22.  INTERFACE
  23.  
  24.  
  25. {$IFC UNDEFINED __SLOTS__}
  26. {$SETC __SLOTS__ := 1}
  27.  
  28.   USES
  29.    ConditionalMacros, Types, Events, OSUtils, Files;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34.  
  35. CONST
  36.     fCardIsChanged                = 1;                            {Card is Changed field in StatusFlags field of sInfoArray}
  37.     fCkForSame                    = 0;                            {For SearchSRT. Flag to check for SAME sResource in the table. }
  38.     fCkForNext                    = 1;                            {For SearchSRT. Flag to check for NEXT sResource in the table. }
  39.     fWarmStart                    = 2;                            {If this bit is set then warm start else cold start.}
  40.  
  41.     stateNil                    = 0;                            {State}
  42.     stateSDMInit                = 1;                            {:Slot declaration manager Init}
  43.     statePRAMInit                = 2;                            {:sPRAM record init}
  44.     statePInit                    = 3;                            {:Primary init}
  45.     stateSInit                    = 4;                            {:Secondary init}
  46. { flags for spParamData }
  47.     fall                        = 0;                            { bit 0: set=search enabled/disabled sRsrc's }
  48.     foneslot                    = 1;                            {    1: set=search sRsrc's in given slot only }
  49.     fnext                        = 2;                            {    2: set=search for next sRsrc }
  50. { Misc masks }
  51.     catMask                        = $08;                            { sets spCategory field of spTBMask (bit 3) }
  52.     cTypeMask                    = $04;                            { sets spCType    field of spTBMask (bit 2) }
  53.     drvrSWMask                    = $02;                            { sets spDrvrSW   field of spTBMask (bit 1) }
  54.     drvrHWMask                    = $01;                            { sets spDrvrHW      field of spTBMask (bit 0) }
  55.  
  56. TYPE
  57.     {
  58.         SlotIntServiceProcPtr uses register based parameters on the 68k and cannot
  59.         be written in or called from a high-level language without the help of
  60.         mixed mode or assembly glue.
  61.  
  62.         In:
  63.          => sqParameter     A1.L
  64.         Out:
  65.          <= return value    D0.W
  66.     }
  67.     SlotIntServiceProcPtr = Register68kProcPtr;  { register FUNCTION SlotIntService(sqParameter: LONGINT): INTEGER; }
  68.     SlotIntServiceUPP = UniversalProcPtr;
  69.  
  70. CONST
  71.     uppSlotIntServiceProcInfo = $0000B822; { Register FUNCTION (4 bytes in A1): 2 bytes in D0; }
  72.  
  73. FUNCTION NewSlotIntServiceProc(userRoutine: SlotIntServiceProcPtr): SlotIntServiceUPP;
  74.     {$IFC NOT GENERATINGCFM }
  75.     INLINE $2E9F;
  76.     {$ENDC}
  77.  
  78. FUNCTION CallSlotIntServiceProc(sqParameter: LONGINT; userRoutine: SlotIntServiceUPP): INTEGER;
  79.     {$IFC NOT GENERATINGCFM}
  80.     {To be implemented:  Glue to move parameters into registers.}
  81.     {$ENDC}
  82.  
  83. TYPE
  84.     SlotIntQElement = RECORD
  85.         sqLink:                    Ptr;                                    {ptr to next element}
  86.         sqType:                    INTEGER;                                {queue type ID for validity}
  87.         sqPrio:                    INTEGER;                                {priority}
  88.         sqAddr:                    SlotIntServiceUPP;                        {interrupt service routine}
  89.         sqParm:                    LONGINT;                                {optional A1 parameter}
  90.     END;
  91.  
  92.     SQElemPtr = ^SlotIntQElement;
  93.  
  94.     SpBlock = RECORD
  95.         spResult:                LONGINT;                                {FUNCTION Result}
  96.         spsPointer:                Ptr;                                    {structure pointer}
  97.         spSize:                    LONGINT;                                {size of structure}
  98.         spOffsetData:            LONGINT;                                {offset/data field used by sOffsetData}
  99.         spIOFileName:            Ptr;                                    {ptr to IOFile name for sDisDrvrName}
  100.         spsExecPBlk:            Ptr;                                    {pointer to sExec parameter block.}
  101.         spParamData:            LONGINT;                                {misc parameter data (formerly spStackPtr).}
  102.         spMisc:                    LONGINT;                                {misc field for SDM.}
  103.         spReserved:                LONGINT;                                {reserved for future expansion}
  104.         spIOReserved:            INTEGER;                                {Reserved field of Slot Resource Table}
  105.         spRefNum:                INTEGER;                                {RefNum}
  106.         spCategory:                INTEGER;                                {sType: Category}
  107.         spCType:                INTEGER;                                {Type}
  108.         spDrvrSW:                INTEGER;                                {DrvrSW}
  109.         spDrvrHW:                INTEGER;                                {DrvrHW}
  110.         spTBMask:                SInt8;                                    {type bit mask bits 0..3 mask words 0..3}
  111.         spSlot:                    SInt8;                                    {slot number}
  112.         spID:                    SInt8;                                    {structure ID}
  113.         spExtDev:                SInt8;                                    {ID of the external device}
  114.         spHwDev:                SInt8;                                    {Id of the hardware device.}
  115.         spByteLanes:            SInt8;                                    {bytelanes from card ROM format block}
  116.         spFlags:                SInt8;                                    {standard flags}
  117.         spKey:                    SInt8;                                    {Internal use only}
  118.     END;
  119.  
  120.     SpBlockPtr = ^SpBlock;
  121.  
  122.     SInfoRecord = RECORD
  123.         siDirPtr:                Ptr;                                    {Pointer to directory}
  124.         siInitStatusA:            INTEGER;                                {initialization E}
  125.         siInitStatusV:            INTEGER;                                {status returned by vendor init code}
  126.         siState:                SInt8;                                    {initialization state}
  127.         siCPUByteLanes:            SInt8;                                    {0=[d0..d7] 1=[d8..d15]}
  128.         siTopOfROM:                SInt8;                                    {Top of ROM= $FssFFFFx: x is TopOfROM}
  129.         siStatusFlags:            SInt8;                                    {bit 0 - card is changed}
  130.         siTOConst:                INTEGER;                                {Time Out C for BusErr}
  131.         siReserved:                ARRAY [0..1] OF SInt8;                    {reserved}
  132.         siROMAddr:                Ptr;                                    { addr of top of ROM }
  133.         siSlot:                    SInt8;                                    { slot number }
  134.         siPadding:                ARRAY [0..2] OF SInt8;                    { reserved }
  135.     END;
  136.  
  137.     SInfoRecPtr = ^SInfoRecord;
  138.  
  139.     SDMRecord = RECORD
  140.         sdBEVSave:                ProcPtr;                                {Save old BusErr vector}
  141.         sdBusErrProc:            ProcPtr;                                {Go here to determine if it is a BusErr}
  142.         sdErrorEntry:            ProcPtr;                                {Go here if BusErrProc finds real BusErr}
  143.         sdReserved:                LONGINT;                                {Reserved}
  144.     END;
  145.  
  146.     FHeaderRec = RECORD
  147.         fhDirOffset:            LONGINT;                                {offset to directory}
  148.         fhLength:                LONGINT;                                {length of ROM}
  149.         fhCRC:                    LONGINT;                                {CRC}
  150.         fhROMRev:                SInt8;                                    {revision of ROM}
  151.         fhFormat:                SInt8;                                    {format - 2}
  152.         fhTstPat:                LONGINT;                                {test pattern}
  153.         fhReserved:                SInt8;                                    {reserved}
  154.         fhByteLanes:            SInt8;                                    {ByteLanes}
  155.     END;
  156.  
  157.     FHeaderRecPtr = ^FHeaderRec;
  158.  
  159. { }
  160. {     Extended Format header block  -  extended declaration ROM format header for super sRsrc directories.    <H2><SM0>}
  161. { }
  162.     XFHeaderRec = RECORD
  163.         fhXSuperInit:            LONGINT;                                {Offset to SuperInit SExecBlock    <fhFormat,offset>}
  164.         fhXSDirOffset:            LONGINT;                                {Offset to SuperDirectory            <$FE,offset>}
  165.         fhXEOL:                    LONGINT;                                {Psuedo end-of-list                <$FF,nil>}
  166.         fhXSTstPat:                LONGINT;                                {TestPattern}
  167.         fhXDirOffset:            LONGINT;                                {Offset to (minimal) directory}
  168.         fhXLength:                LONGINT;                                {Length of ROM}
  169.         fhXCRC:                    LONGINT;                                {CRC}
  170.         fhXROMRev:                SInt8;                                    {Revision of ROM}
  171.         fhXFormat:                SInt8;                                    {Format-2}
  172.         fhXTstPat:                LONGINT;                                {TestPattern}
  173.         fhXReserved:            SInt8;                                    {Reserved}
  174.         fhXByteLanes:            SInt8;                                    {ByteLanes}
  175.     END;
  176.  
  177.     XFHeaderRecPtr = ^XFHeaderRec;
  178.  
  179.     SEBlock = PACKED RECORD
  180.         seSlot:                    UInt8;                                    {Slot number.}
  181.         sesRsrcId:                UInt8;                                    {sResource Id.}
  182.         seStatus:                INTEGER;                                {Status of code executed by sExec.}
  183.         seFlags:                UInt8;                                    {Flags}
  184.         seFiller0:                UInt8;                                    {Filler, must be SignedByte to align on odd boundry}
  185.         seFiller1:                UInt8;                                    {Filler}
  186.         seFiller2:                UInt8;                                    {Filler}
  187.         seResult:                LONGINT;                                {Result of sLoad.}
  188.         seIOFileName:            LONGINT;                                {Pointer to IOFile name.}
  189.         seDevice:                UInt8;                                    {Which device to read from.}
  190.         sePartition:            UInt8;                                    {The partition.}
  191.         seOSType:                UInt8;                                    {Type of OS.}
  192.         seReserved:                UInt8;                                    {Reserved field.}
  193.         seRefNum:                UInt8;                                    {RefNum of the driver.}
  194.         seNumDevices:            UInt8;                                    { Number of devices to load.}
  195.         seBootState:            UInt8;                                    {State of StartBoot code.}
  196.     END;
  197.  
  198. {  Principle  }
  199.  
  200. FUNCTION SReadByte(spBlkPtr: SpBlockPtr): OSErr;
  201.     {$IFC NOT GENERATINGCFM}
  202.     INLINE $205F, $7000, $A06E, $3E80;
  203.     {$ENDC}
  204. FUNCTION SReadWord(spBlkPtr: SpBlockPtr): OSErr;
  205.     {$IFC NOT GENERATINGCFM}
  206.     INLINE $205F, $7001, $A06E, $3E80;
  207.     {$ENDC}
  208. FUNCTION SReadLong(spBlkPtr: SpBlockPtr): OSErr;
  209.     {$IFC NOT GENERATINGCFM}
  210.     INLINE $205F, $7002, $A06E, $3E80;
  211.     {$ENDC}
  212. FUNCTION SGetCString(spBlkPtr: SpBlockPtr): OSErr;
  213.     {$IFC NOT GENERATINGCFM}
  214.     INLINE $205F, $7003, $A06E, $3E80;
  215.     {$ENDC}
  216. FUNCTION SGetBlock(spBlkPtr: SpBlockPtr): OSErr;
  217.     {$IFC NOT GENERATINGCFM}
  218.     INLINE $205F, $7005, $A06E, $3E80;
  219.     {$ENDC}
  220. FUNCTION SFindStruct(spBlkPtr: SpBlockPtr): OSErr;
  221.     {$IFC NOT GENERATINGCFM}
  222.     INLINE $205F, $7006, $A06E, $3E80;
  223.     {$ENDC}
  224. FUNCTION SReadStruct(spBlkPtr: SpBlockPtr): OSErr;
  225.     {$IFC NOT GENERATINGCFM}
  226.     INLINE $205F, $7007, $A06E, $3E80;
  227.     {$ENDC}
  228. {  Special  }
  229. FUNCTION SReadInfo(spBlkPtr: SpBlockPtr): OSErr;
  230.     {$IFC NOT GENERATINGCFM}
  231.     INLINE $205F, $7010, $A06E, $3E80;
  232.     {$ENDC}
  233. FUNCTION SReadPRAMRec(spBlkPtr: SpBlockPtr): OSErr;
  234.     {$IFC NOT GENERATINGCFM}
  235.     INLINE $205F, $7011, $A06E, $3E80;
  236.     {$ENDC}
  237. FUNCTION SPutPRAMRec(spBlkPtr: SpBlockPtr): OSErr;
  238.     {$IFC NOT GENERATINGCFM}
  239.     INLINE $205F, $7012, $A06E, $3E80;
  240.     {$ENDC}
  241. FUNCTION SReadFHeader(spBlkPtr: SpBlockPtr): OSErr;
  242.     {$IFC NOT GENERATINGCFM}
  243.     INLINE $205F, $7013, $A06E, $3E80;
  244.     {$ENDC}
  245. FUNCTION SNextSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  246.     {$IFC NOT GENERATINGCFM}
  247.     INLINE $205F, $7014, $A06E, $3E80;
  248.     {$ENDC}
  249. FUNCTION SNextTypeSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  250.     {$IFC NOT GENERATINGCFM}
  251.     INLINE $205F, $7015, $A06E, $3E80;
  252.     {$ENDC}
  253. FUNCTION SRsrcInfo(spBlkPtr: SpBlockPtr): OSErr;
  254.     {$IFC NOT GENERATINGCFM}
  255.     INLINE $205F, $7016, $A06E, $3E80;
  256.     {$ENDC}
  257. FUNCTION SDisposePtr(spBlkPtr: SpBlockPtr): OSErr;
  258.     {$IFC NOT GENERATINGCFM}
  259.     INLINE $205F, $7017, $A06E, $3E80;
  260.     {$ENDC}
  261. FUNCTION SCkCardStat(spBlkPtr: SpBlockPtr): OSErr;
  262.     {$IFC NOT GENERATINGCFM}
  263.     INLINE $205F, $7018, $A06E, $3E80;
  264.     {$ENDC}
  265. FUNCTION SReadDrvrName(spBlkPtr: SpBlockPtr): OSErr;
  266.     {$IFC NOT GENERATINGCFM}
  267.     INLINE $205F, $7019, $A06E, $3E80;
  268.     {$ENDC}
  269. FUNCTION SFindSRTRec(spBlkPtr: SpBlockPtr): OSErr;
  270.     {$IFC NOT GENERATINGCFM}
  271.     INLINE $205F, $701A, $A06E, $3E80;
  272.     {$ENDC}
  273. FUNCTION SFindDevBase(spBlkPtr: SpBlockPtr): OSErr;
  274.     {$IFC NOT GENERATINGCFM}
  275.     INLINE $205F, $701B, $A06E, $3E80;
  276.     {$ENDC}
  277. FUNCTION SFindBigDevBase(spBlkPtr: SpBlockPtr): OSErr;
  278.     {$IFC NOT GENERATINGCFM}
  279.     INLINE $205F, $701C, $A06E, $3E80;
  280.     {$ENDC}
  281. {  Advanced  }
  282. FUNCTION InitSDeclMgr(spBlkPtr: SpBlockPtr): OSErr;
  283.     {$IFC NOT GENERATINGCFM}
  284.     INLINE $205F, $7020, $A06E, $3E80;
  285.     {$ENDC}
  286. FUNCTION SPrimaryInit(spBlkPtr: SpBlockPtr): OSErr;
  287.     {$IFC NOT GENERATINGCFM}
  288.     INLINE $205F, $7021, $A06E, $3E80;
  289.     {$ENDC}
  290. FUNCTION SCardChanged(spBlkPtr: SpBlockPtr): OSErr;
  291.     {$IFC NOT GENERATINGCFM}
  292.     INLINE $205F, $7022, $A06E, $3E80;
  293.     {$ENDC}
  294. FUNCTION SExec(spBlkPtr: SpBlockPtr): OSErr;
  295.     {$IFC NOT GENERATINGCFM}
  296.     INLINE $205F, $7023, $A06E, $3E80;
  297.     {$ENDC}
  298. FUNCTION SOffsetData(spBlkPtr: SpBlockPtr): OSErr;
  299.     {$IFC NOT GENERATINGCFM}
  300.     INLINE $205F, $7024, $A06E, $3E80;
  301.     {$ENDC}
  302. FUNCTION SInitPRAMRecs(spBlkPtr: SpBlockPtr): OSErr;
  303.     {$IFC NOT GENERATINGCFM}
  304.     INLINE $205F, $7025, $A06E, $3E80;
  305.     {$ENDC}
  306. FUNCTION SReadPBSize(spBlkPtr: SpBlockPtr): OSErr;
  307.     {$IFC NOT GENERATINGCFM}
  308.     INLINE $205F, $7026, $A06E, $3E80;
  309.     {$ENDC}
  310. FUNCTION SCalcStep(spBlkPtr: SpBlockPtr): OSErr;
  311.     {$IFC NOT GENERATINGCFM}
  312.     INLINE $205F, $7028, $A06E, $3E80;
  313.     {$ENDC}
  314. FUNCTION SInitSRsrcTable(spBlkPtr: SpBlockPtr): OSErr;
  315.     {$IFC NOT GENERATINGCFM}
  316.     INLINE $205F, $7029, $A06E, $3E80;
  317.     {$ENDC}
  318. FUNCTION SSearchSRT(spBlkPtr: SpBlockPtr): OSErr;
  319.     {$IFC NOT GENERATINGCFM}
  320.     INLINE $205F, $702A, $A06E, $3E80;
  321.     {$ENDC}
  322. FUNCTION SUpdateSRT(spBlkPtr: SpBlockPtr): OSErr;
  323.     {$IFC NOT GENERATINGCFM}
  324.     INLINE $205F, $702B, $A06E, $3E80;
  325.     {$ENDC}
  326. FUNCTION SCalcSPointer(spBlkPtr: SpBlockPtr): OSErr;
  327.     {$IFC NOT GENERATINGCFM}
  328.     INLINE $205F, $702C, $A06E, $3E80;
  329.     {$ENDC}
  330. FUNCTION SGetDriver(spBlkPtr: SpBlockPtr): OSErr;
  331.     {$IFC NOT GENERATINGCFM}
  332.     INLINE $205F, $702D, $A06E, $3E80;
  333.     {$ENDC}
  334. FUNCTION SPtrToSlot(spBlkPtr: SpBlockPtr): OSErr;
  335.     {$IFC NOT GENERATINGCFM}
  336.     INLINE $205F, $702E, $A06E, $3E80;
  337.     {$ENDC}
  338. FUNCTION SFindSInfoRecPtr(spBlkPtr: SpBlockPtr): OSErr;
  339.     {$IFC NOT GENERATINGCFM}
  340.     INLINE $205F, $702F, $A06E, $3E80;
  341.     {$ENDC}
  342. FUNCTION SFindSRsrcPtr(spBlkPtr: SpBlockPtr): OSErr;
  343.     {$IFC NOT GENERATINGCFM}
  344.     INLINE $205F, $7030, $A06E, $3E80;
  345.     {$ENDC}
  346. FUNCTION SDeleteSRTRec(spBlkPtr: SpBlockPtr): OSErr;
  347.     {$IFC NOT GENERATINGCFM}
  348.     INLINE $205F, $7031, $A06E, $3E80;
  349.     {$ENDC}
  350. FUNCTION OpenSlot(paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  351. FUNCTION OpenSlotSync(paramBlock: ParmBlkPtr): OSErr;
  352.     {$IFC NOT GENERATINGCFM}
  353.     INLINE $205F, $A200, $3E80;
  354.     {$ENDC}
  355. FUNCTION OpenSlotAsync(paramBlock: ParmBlkPtr): OSErr;
  356.     {$IFC NOT GENERATINGCFM}
  357.     INLINE $205F, $A600, $3E80;
  358.     {$ENDC}
  359. {  Device Manager Slot Support  }
  360. FUNCTION SIntInstall(sIntQElemPtr: SQElemPtr; theSlot: INTEGER): OSErr;
  361.     {$IFC NOT GENERATINGCFM}
  362.     INLINE $301F, $205F, $A075, $3E80;
  363.     {$ENDC}
  364. FUNCTION SIntRemove(sIntQElemPtr: SQElemPtr; theSlot: INTEGER): OSErr;
  365.     {$IFC NOT GENERATINGCFM}
  366.     INLINE $301F, $205F, $A076, $3E80;
  367.     {$ENDC}
  368. FUNCTION SVersion(spBlkPtr: SpBlockPtr): OSErr;
  369.     {$IFC NOT GENERATINGCFM}
  370.     INLINE $205F, $7008, $A06E, $3E80;
  371.     {$ENDC}
  372. FUNCTION SetSRsrcState(spBlkPtr: SpBlockPtr): OSErr;
  373.     {$IFC NOT GENERATINGCFM}
  374.     INLINE $205F, $7009, $A06E, $3E80;
  375.     {$ENDC}
  376. FUNCTION InsertSRTRec(spBlkPtr: SpBlockPtr): OSErr;
  377.     {$IFC NOT GENERATINGCFM}
  378.     INLINE $205F, $700A, $A06E, $3E80;
  379.     {$ENDC}
  380. FUNCTION SGetSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  381.     {$IFC NOT GENERATINGCFM}
  382.     INLINE $205F, $700B, $A06E, $3E80;
  383.     {$ENDC}
  384. FUNCTION SGetTypeSRsrc(spBlkPtr: SpBlockPtr): OSErr;
  385.     {$IFC NOT GENERATINGCFM}
  386.     INLINE $205F, $700C, $A06E, $3E80;
  387.     {$ENDC}
  388. FUNCTION SGetSRsrcPtr(spBlkPtr: SpBlockPtr): OSErr;
  389.     {$IFC NOT GENERATINGCFM}
  390.     INLINE $205F, $701D, $A06E, $3E80;
  391.     {$ENDC}
  392.  
  393. { $ALIGN RESET}
  394. { $POP}
  395.  
  396. {$ENDC} {__SLOTS__}
  397.  
  398.  IMPLEMENTATION
  399.  END.
  400.  
  401.